<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>地图</title>
    <script src="https://webapi.amap.com/maps?v=1.4.15&key=bfbb1b2adb5d3f5a0fb0b369ed254a7b"></script>
    <style>
        html, body, #map {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">

    function getUrlParam(name) {
        var url = window.location.search
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)")
        var result = url.substr(1).match(reg)
        return result ? decodeURIComponent(result[2]) : null
    }

    var title = decodeURIComponent(getUrlParam('title')) || ''
    var l = getUrlParam('location').split(',')
    var center = [l[0], l[1]]
    var zoom = getUrlParam('zoom') || 18
    var map = new AMap.Map('map', {
        center: center,
        zoom: zoom
    })
    var marker = new AMap.Marker({
        position: new AMap.LngLat(l[0], l[1]),
        title: title
    })
    map.add(marker)
</script>
</body>
</html>
